package com.qzsoft.zhjd.materiel.modules.materieldevice.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.qzsoft.jeemis.common.validator.group.AddGroup;
import com.qzsoft.jeemis.common.validator.group.UpdateGroup;
import lombok.*;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotBlank;
import java.util.Date;

/**
 * @author linhuawei
 * @ClassName MaterielDeviceEntity
 * @Description 设备设备
 * @since 2022-03-31
 */
@Data
@EqualsAndHashCode(callSuper = false)
@NoArgsConstructor
@AllArgsConstructor
@Builder
@ToString
@TableName("n_materiel_device")
public class MaterielDeviceEntity {

    /**
     * 主键
     */
    @NotBlank(groups = UpdateGroup.class, message = "标识不可为空")
    @TableId(type = IdType.ASSIGN_UUID)
    private String id;

    /**
     * 基地编码
     */
    @NotBlank(groups = AddGroup.class, message = "所属工地地不可为空")
    @TableField(updateStrategy = FieldStrategy.NEVER)
    private String baseCode;
    @TableField(exist = false)
    private String baseName;

    /**
     * 设备名称
     */
//    @TableField(updateStrategy = FieldStrategy.NEVER)
    private String name;

    /**
     * 设备编码
     */
    @NotBlank(groups = AddGroup.class, message = "设备编号不可为空")
//    @Pattern(groups = AddGroup.class, regexp = "^[0-9]{1}$", message = "设备编号格式错误")
//    @TableField(updateStrategy = FieldStrategy.NEVER)
    private String code;

    /**
     * 设备厂商
     */
    @Length(groups = {AddGroup.class, UpdateGroup.class}, max = 20, message = "设备厂商不可超过{max}个字")
    @TableField(updateStrategy = FieldStrategy.IGNORED)
    private String weighbridgeManufacturer;

    /**
     * 设备联系人
     */
    @Length(groups = {AddGroup.class, UpdateGroup.class}, max = 20, message = "设备联系人不可超过{max}个字")
    @TableField(updateStrategy = FieldStrategy.IGNORED)
    private String weighbridgeContacts;

    /**
     * 设备型号
     */
    @Length(groups = {AddGroup.class, UpdateGroup.class}, max = 20, message = "设备型号不可超过{max}个字")
    @TableField(updateStrategy = FieldStrategy.IGNORED)
    private String weighbridgeModel;

    /**
     * 设备厂商电话
     */
    @Length(groups = {AddGroup.class, UpdateGroup.class}, max = 11, message = "设备厂商电话格式错误")
    @TableField(updateStrategy = FieldStrategy.IGNORED)
    private String weighbridgePhone;

    /**
     * 仪表厂商
     */
    @Length(groups = {AddGroup.class, UpdateGroup.class}, max = 20, message = "设备名称不可超过{max}个字")
    @TableField(updateStrategy = FieldStrategy.IGNORED)
    private String instrumentManufacturer;

    /**
     * 仪表联系人
     */
    @Length(groups = {AddGroup.class, UpdateGroup.class}, max = 20, message = "仪表联系人不可超过{max}个字")
    @TableField(updateStrategy = FieldStrategy.IGNORED)
    private String instrumentContacts;

    /**
     * 仪表型号
     */
    @Length(groups = {AddGroup.class, UpdateGroup.class}, max = 20, message = "仪表型号不可超过{max}个字")
    @TableField(updateStrategy = FieldStrategy.IGNORED)
    private String instrumentModel;

    /**
     * 仪表厂商电话
     */
    @Length(groups = {AddGroup.class, UpdateGroup.class}, max = 11, message = "仪表厂商电话格式错误")
    @TableField(updateStrategy = FieldStrategy.IGNORED)
    private String instrumentPhone;

    /**
     * 备注
     */
    @Length(groups = {AddGroup.class, UpdateGroup.class}, max = 200, message = "备注不可超过{max}个字")
    @TableField(updateStrategy = FieldStrategy.IGNORED)
    private String remark;

    /**
     * 添加人主键
     */
    @TableField(fill = FieldFill.INSERT, updateStrategy = FieldStrategy.NEVER)
    private Long creator;

    /**
     * 添加时间
     */
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Date createDate;

    /**
     * 最后修改人主键
     */
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Long updater;

    /**
     * 最后修改时间
     */
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Date updateDate;

}
